package dto_pakinfo;
// Generated Mar 20, 2013 5:08:51 PM by Hibernate Tools 3.2.1.GA

import dto.*;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;

/**
 * User generated by hbm2java
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "User", propOrder= {
    "id",
    "username",
    "isAdmin",
    "createDate",
    "updateDate",
    "isDeleted",
    "profile"
})
@Entity
@Table(name = "[User]", schema = "dbo", catalog = "AntiqueShop")
@XmlRootElement(name = "user")
public class User implements java.io.Serializable {

    @XmlAttribute(name = "id", required = true)
    private int id;
    @XmlElement(required = true)
    private String username;
    @XmlTransient
    private String password;
    @XmlElement(required = true)
    private boolean isAdmin;

    @XmlElement(required = false)
    private Date createDate;

    @XmlElement(required = false)
    private Date updateDate;
    
    @XmlElement(required = true)
    private boolean isDeleted;

    @XmlElement
    private Profile profile;

    @XmlTransient
    private Set<Order> orders = new HashSet<Order>(0);

    public User() {
    }

    public User(int id, String username, String password, boolean isAdmin, boolean isDeleted) {
        this.id = id;
        this.username = username;
        this.password = password;
        this.isAdmin = isAdmin;
        this.isDeleted = isDeleted;
    }

    public User(int id, String username, String password, boolean isAdmin, Date createDate, Date updateDate, boolean isDeleted, Profile profile, Set<Order> orders) {
        this.id = id;
        this.username = username;
        this.password = password;
        this.isAdmin = isAdmin;
        this.createDate = createDate;
        this.updateDate = updateDate;
        this.isDeleted = isDeleted;
        this.profile = profile;
        this.orders = orders;
    }

    @Id
    @GeneratedValue(strategy=GenerationType.IDENTITY)
    @Column(name = "id", unique = true, nullable = false)
    public int getId() {
        return this.id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Column(name = "username", nullable = false)
    public String getUsername() {
        return this.username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    @Column(name = "password", nullable = false)
    public String getPassword() {
        return this.password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    @Column(name = "is_admin", nullable = false)
    public boolean isIsAdmin() {
        return this.isAdmin;
    }

    public void setIsAdmin(boolean isAdmin) {
        this.isAdmin = isAdmin;
    }

    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "create_date", length = 23)
    public Date getCreateDate() {
        return this.createDate;
    }

    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }

    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "update_date", length = 23)
    public Date getUpdateDate() {
        return this.updateDate;
    }

    public void setUpdateDate(Date updateDate) {
        this.updateDate = updateDate;
    }

    @Column(name = "is_deleted", nullable = false)
    public boolean isIsDeleted() {
        return this.isDeleted;
    }

    public void setIsDeleted(boolean isDeleted) {
        this.isDeleted = isDeleted;
    }

    @OneToOne(cascade=CascadeType.ALL, fetch=FetchType.EAGER)
    @PrimaryKeyJoinColumn
    public Profile getProfile() {
        return this.profile;
    }

    public void setProfile(Profile profile) {
        this.profile = profile;
    }

    @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "user")
    public Set<Order> getOrders() {
        return this.orders;
    }

    public void setOrders(Set<Order> orders) {
        this.orders = orders;
    }
}
